<!DOCTYPE html> 
 <html> 
 <head> 
     <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 
     <link rel="stylesheet" 
           data-name="vs/editor/editor.main" 
           href="./editor/editor.main.css" /> 
     <style> 
         html, body { height: 100%; margin: 0; } 
         #container { height: 100%; } 
     </style> 
 </head> 
 <body> 
     <div id="container"></div> 
     <script src="./loader.js"></script> 
     <script> 
         require.config({ paths: { 'vs': './' } }); 
     </script> 
     <script src="./editor/editor.main.nls.js"></script> 
     <script src="./editor/editor.main.js"></script> 
     <script src="./test.js"></script> 
     <script> 

monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
	noSemanticValidation: true,
	noSyntaxValidation: false
});

// compiler options
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
	target: monaco.languages.typescript.ScriptTarget.ES6,
	allowNonTsExtensions: true,
	allowJs: true
});
       
// extra libraries
var libSource = [
	'declare class ParameterObject {',
	'    parameterRefId:string',
	'    name:string',
	'    isActive:bool',
	'    value:string',
	'}',
	'declare class DeviceObject {',
	'    /**',
	'     * Gets a localized message text',
	'     */',
	'    getMessage(messagenumber:number):string',
	'    getParameterById(id:string):ParameterObject',
	'    getParameterByName(name:string):ParameterObject',
	'}',
	'declare class ProgressObject {',
	'    setProgress(percent:number)',
	'    setText(id:string)',
	'    isCanceled():bool',
	'}',
	'declare class OnlineObject {',
	'    connect()',
	'    disconnect()',
	'    readDeviceDescriptor0():number',
	'    readFunctionProperty(objidx:number, propid:number, data:array):array',
	'    invokeFunctionProperty(objidx:number, propid:number, data:array):array',
	'    readProperty(objidx:number, propid:number, propType:number, startElement:number, count:number):array',
	'    writeProperty(objidx:number, propid:number, propType:number, startElement:number, count:number, data:array, verify:bool)',
	'    readMemory(startaddr:number, size:number):array',
	'    writeMemory(startaddr:number, data:array, verify:true)',
	'    readUserMemory(startaddr:number, size:number):array',
	'    writeUserMemory(startaddr:number, data:array, verify:true)',
	'    restart()',
	'}',
	'declare class AppObject {',
	'    getMessage(messagenumber:number):string',
	'    getMessage(messagename:string):string',
	'}',
    'const device:DeviceObject;',
    'const online:OnlineObject;',
    'const progress:ProgressObject;',
    'const ApplicationProgram:AppObject;',
	window.x
].join('\n');
var libUri = 'ts:filename/facts.d.ts';
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
monaco.editor.createModel(libSource, 'typescript', monaco.Uri.parse(libUri));
       
        var editor = monaco.editor.create(document.getElementById('container'), { 
            value: '', 
            language: 'javascript',
            automaticLayout: true
        }); 
     </script> 
 </body> 
 </html>
